// HSS.Forms.ListViewAPI.cs
// ----------------------------------------------------------------------------
// Licensed under the MIT license
// http://www.opensource.org/licenses/mit-license.html
// ----------------------------------------------------------------------------
// HighSpeed-Solutions, LLC
// Copyright (c) 2001-2010
// ----------------------------------------------------------------------------
// File:       ListViewAPI.cs
// Author:     HSS\gbanta
// Created:    08/12/2010
// Modified:   12/04/2010
// ----------------------------------------------------------------------------
namespace HSS.Forms
{
	#region Using Directives
	using System;
	using System.Runtime.InteropServices;
	#endregion

	#region ListViewAPI
	internal class ListViewAPI
	{
		[StructLayout(LayoutKind.Sequential)]
		public struct HDITEM
		{
			public Int32 mask;
			public Int32 cxy;
			[MarshalAs(UnmanagedType.LPTStr)]
			public String pszText;
			public IntPtr hbm;
			public Int32 cchTextMax;
			public Int32 fmt;
			public Int32 lParam;
			public Int32 iImage;
			public Int32 iOrder;
		};

		// Parameters for ListView-Headers
		public const Int32 HDI_FORMAT = 0x0004;
		public const Int32 HDF_LEFT = 0x0000;
		public const Int32 HDF_STRING = 0x4000;
		public const Int32 HDF_SORTUP = 0x0400;
		public const Int32 HDF_SORTDOWN = 0x0200;
		public const Int32 HDM_GETITEM = 0x1200 + 11;  // HDM_FIRST + 11
		public const Int32 HDM_SETITEM = 0x1200 + 12;  // HDM_FIRST + 12
		public const Int32 LVM_GETHEADER = 0x1000 + 31;  // LVM_FIRST + 31
		public const Int32 LVM_SETGROUPINFO = 0x1000 + 147;  // LVM_FIRST + 147
		public const Int32 LVM_GETGROUPINFO = 0x1000 + 149;  // LVM_FIRST + 147
		public const Int32 LVM_GETGROUPINFOBYINDEX = 0x1000 + 153;  // LVM_FIRST + 153
		public const Int32 LVGF_SUBSETITEMS = 0x00010000;

		[DllImport("user32.dll")]
		public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);

		[DllImport("user32.dll", EntryPoint = "SendMessage")]
		public static extern IntPtr SendMessageITEM(IntPtr Handle, Int32 msg, IntPtr wParam, ref HDITEM lParam);
	}
	#endregion
}